package com.demo.rpc.dto;

import com.demo.base.BaseDTO;
import com.demo.holder.ThreadContextHolder;

/**
 * Created by hunter
 *
 * @Description 基础远程调用的请求体, 远程调用需要支持调用事务的请求体需要集成此类
 */
public class BaseRPCDTO implements BaseDTO {

    /**
     * 事务id
     */
    private String transactionId;

    public String getTransactionId() {

        return this.transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public BaseRPCDTO() {
        // 初始化时, 填充线程变量里的事务id值
        if (ThreadContextHolder.getTransactionId() != null) {
            this.transactionId = ThreadContextHolder.getTransactionId();
        }
    }
}
